package toster;

/**
 *
 * @author Rcluster
 */
public class BaseCase {
    public volatile int[][] grid;
    public int rowLen, colLen; 
    public static final int filled = Function.filled, empty = Function.empty;

    
    public BaseCase(int rows, int cols) {
        grid = new int[rows][cols];
        rowLen = cols;
        colLen = rows;
    }

    
    public synchronized void setRow(int index, int[] rowData) {
        grid[index]=rowData.clone();
    }

    public synchronized void setCol(int index, int[] colData) {
        for (int i = 0; i < colLen; i++) {
            grid[i][index] = colData[i];
        }
    }

    public int[] getRow(int index) {
        return grid[index];
    }

    public int[] getCol(int index) {
        if (!( index < rowLen))  return new int[] {};
        int[] col = new int[colLen];
        for (int i = 0; i < colLen; i++) {
            col[i] = grid[i][index];
        }
        return col;
    }
}